package com.boco.pciv.core.entity;

import java.util.Map;

public class ScrollCriteria extends CriteriaBase {
    //开始id
    private Long scollId;
    //加载数据条数
    private Integer size;

    public ScrollCriteria() {
        scollId=0l;
        size=10;
    }

    public Long getScollId() {
        return scollId;
    }

    public void setScollId(Long scollId) {
        this.scollId = scollId;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        if (size<=0) return;
        this.size = size;
    }

    //生成查询条件
    public Map<String,Object> getQueryMap(){
        if (this.scollId!=null && this.scollId>0) {
            putCriteria("scollId", this.scollId);
        }
        putCriteria("size", this.size);
        return getCondMap();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String,Object> entity : getCondMap().entrySet()) {
            sb.append(",");
            sb.append(entity.getKey());
            sb.append("=");
            sb.append(entity.getValue() ==null?"":entity.getValue().toString());
        }
        return "ScrollCriteria{" +
                "scollId=" + scollId +
                ", size=" + size +
                sb.toString() +
                '}';
    }
}
